package com.heima.controller;

import com.heima.pojo.dto.AddVmTypeDTO;
import com.heima.pojo.dto.PageSearchDTO;
import com.heima.pojo.vo.PageSearchQueryVO;
import com.heima.pojo.vo.VmTypeVO;
import com.heima.service.VmTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/vm-service/vmType")
@Api(tags = "设备类型管理接口")
public class VmTypeController {

    @Autowired
    VmTypeService vmTypeService;

    /**
     * 设备类型分页搜索
     * */
    @ApiOperation("设备类型分页搜索")
    @GetMapping("/search")
    public PageSearchQueryVO search(PageSearchDTO dto){
        PageSearchQueryVO  vo = vmTypeService.search(dto);
        return vo;
    }
    /**
     * 新增设备类型
     * */
    @ApiOperation("新增设备类型")
    @PostMapping
    public Boolean add(@RequestBody AddVmTypeDTO dto){
        vmTypeService.add(dto);
        return true;
    }
}
